home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************************************
- 6/96 bob Updated #includes to support changed GX Library names.
-
- ©1990 - 1996 Apple Computer, Inc.
- All rights reserved.
- ****************************************************************************************************/
- #include <Types.h>
- #include <QuickDraw.h>
- #include <Fonts.h>
- #include <Windows.h>
- #include <Menus.h>
- #include <SegLoad.h>
- #include <Memory.h>
- #include <Desk.h>
-
- #include <GXGraphics.h>
- #include "GraphicsLibraries.h"
- #include <GXEnvironment.h>
-
- #include <GXTypes.h>
- #include <GXLayout.h>
- #include "LayoutLibrary.h"
-
- #include "SampleInterface.h"
-
-
- short MyStrLen(char *x);
- static short MyStrLen(x)
- char *x;
- {
- short c = 0;
- while (*x++) c++;
- return c;
- } /* MyStrLen */
-
- void BaselineAlignment(WindowPtr sampleWindow)
- {
- /* Variables */
- char *myString = "Drop Caps";
- gxLayoutOptions gxLayoutOptions;
- gxLineBaselineRecord gxLineBaselineRecord;
- gxPoint myPoint;
- gxRunControls gxRunControls;
- gxShape layout;
- short len, level = 0, runLengths[4];
- gxStyle dropCapsStyle, regularStyle, styleArray[4];
- gxViewPort aViewPort;
-
- /* Initialization */
-
- myPoint.x = ff(20);
- myPoint.y = ff(50);
-
- aViewPort = GXNewWindowViewPort(sampleWindow);
- SetDefaultViewPort(aViewPort);
-
- len = MyStrLen(myString);
- runLengths[0] = runLengths[2] = 1;
- runLengths[1] = 4;
- runLengths[3] = 3;
-
- regularStyle = NewLayoutStyle((char *) "\pHoefler Text", ff(40), 0, nil, nil, 0, nil);
-
- InitializeRunControls(&gxRunControls);
- gxRunControls.baselineType = gxHangingBaseline;
- dropCapsStyle = NewLayoutStyle((char *) "\pHoefler Text", ff(70), 0, &gxRunControls, nil, 0, nil);
-
- InitializeLayoutOptions(&gxLayoutOptions);
- GXGetStyleBaselineDeltas(regularStyle, gxRomanBaseline, gxLineBaselineRecord.deltas);
- gxLayoutOptions.baselineRec = &gxLineBaselineRecord;
-
- styleArray[0] = styleArray[2] = dropCapsStyle;
- styleArray[1] = styleArray[3] = regularStyle;
-
- layout = GXNewLayout(
- 1, &len, (void *) &myString,
- 4, runLengths, styleArray,
- 1, &len, &level,
- &gxLayoutOptions, &myPoint);
- GXDrawShape(layout);
-
- GXSetStyleTextSize(dropCapsStyle, ff(110));
- GXMoveShape(layout, 0, ff(100));
- GXDrawShape(layout);
-
- GXDisposeShape(layout);
- GXDisposeStyle(regularStyle);
- GXDisposeStyle(dropCapsStyle);
- GXDisposeViewPort(aViewPort);
- } /* main */
-